Window_SkillStatus.prototype.initialize = function(x, y, width, height) {
  Window_Base.prototype.initialize.call(this, x, y, width, height);
  this._actor = null;
  this._portraitSprite = new Sprite_Base(); //先创建立绘图，就不会被添加到child
  this.refresh();
  this.opacity = 0;
};

Window_SkillStatus.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
      this.drawActorName(this._actor, 36, 32, 64);
        this.SWDA_drawActorPortrait(this._actor, 0, 0);
        if (SceneManager._scene instanceof Scene_Skill){
          this.drawGaugeArea(this._actor);
        }
    }
};

Window_SkillStatus.prototype.drawActorName = function (actor, x, y, width) {
  width = width || 168;
  if (!this._nameBgSprite){
    this._nameBgSprite = new Sprite_Base();
    this._nameBgSprite.bitmap = ImageManager.loadBitmap('img/system/UI/', 'MenuBg_Name');
    this._nameBgSprite.x = -this.x + x;
    this._nameBgSprite.y = -this.y;
    this.addChildAt(this._nameBgSprite,0);
  }
  this.setTitleFont();
  this.changeTextColor(this.textColor(0));
  this.contents.fontBold = true;
  this.drawVerticalText(actor.name(), x, y, width, this.titleFontSize(), 'center')
  this.resetFontSettings();
};


// 画状态条
Window_SkillStatus.prototype.drawGaugeArea = function (actor) {
  const [x, y, width, height] = [330, 100, 120, this.lineHeight() * 2.5];
  this._enableYBuffer = true;
  const wy = y + height - this.lineHeight();
  let wymod = (Imported.YEP_CoreEngine) ? Yanfly.Param.GaugeHeight : 6;
  wymod = Math.max(16, wymod) * 1.5;
  this.drawActorHp(actor, x, wy - wymod * 2, width);
  this.drawActorMp(actor, x, wy - wymod, width);
  this.drawActorTp(actor, x, wy, width);
  this._enableYBuffer = false;
};

// 状态条文字偏移
Window_SkillStatus.prototype.drawText = function (text, wx, wy, ww, align) {
  if (this._enableYBuffer) {
    wy += 7;
    wx += 2;
    ww -= 4;
  }
  Window_Selectable.prototype.drawText.call(this, text, wx, wy, ww, align);
};

// 人物信息字体
Window_SkillStatus.prototype.drawCurrentAndMax = function (current, max, x, y,
  width, color1, color2) {
  this.setSmallerFont();
  this.contents.fontSize = 18;
  Window_Selectable.prototype.drawCurrentAndMax.call(this, current, max,
    x, y - 4, width, color1, this.textColor(0));	// 修改最大值颜色
};


// 人物信息颜色
Window_SkillStatus.prototype.hpColor = function (actor) {
  if (actor.isDead()) {
    return this.deathColor();
  } else if (actor.isDying()) {
    return this.crisisColor();
  } else {
    return this.textColor(0);
  }
};

Window_SkillStatus.prototype.mpColor = function (actor) {
  return this.textColor(0);
};

Window_SkillStatus.prototype.tpColor = function (actor) {
  return this.textColor(0);
};

Window_SkillStatus.prototype.drawNameArea = function (actor) {
  this.setSmallerFont();
  this.contents.fontSize = 20;
  this.drawActorName(actor, 0, 0, this.contents.width);
  this.resetFontSettings();
};